let fn_index = async (ctx, next) => {
    ctx.render('index.html', {
      title: 'Welcome'
    })
}

let fn_signin = async (ctx, next) => {
  let
    email = ctx.request.body.email || ''
    password = ctx.request.body.password || ''
  console.log(`signin with email: ${email}, password: ${password}`)
  if (email === 'koa@163.com' && password === '12345') {
    // 登录成功
    ctx.render('signin-ok.html', {
      title: 'Sign In OK',
      name: email
    })
  } else {
    // 登录失败
    ctx.render('signin-failed.html', {
      title: 'Sign In Failde'
    })
  }
}

module.exports = {
  'GET /': fn_index,
  'POST /signin': fn_signin
}
